package com.societyGames.codeAlong.state.codeExercise.model.help
{
	import com.societyGames.codeAlong.state.codeExercise.model.SyntaxErrorMessage;
	import com.societyGames.system.IXmlInitialize;

	public class BeginsWithSyntaxHelp implements ISyntaxErrorHelp, IXmlInitialize
	{
		private var _beginsWith:String;
		private var _help:String;
		
		//IXmlInitialize-->
		public function initializeWithXml(xml:XML):void
		{
			this._beginsWith = xml.beginsWith[0].toString();
			this._help = xml.help[0].toString();
		}
		//<--IXmlInitialize
		
		//ISyntaxErrorHelp-->
		public function getHelp(syntaxErrorMessage:SyntaxErrorMessage):String //Returns hyper text help.
		{	
			if (syntaxErrorMessage.message.search(_beginsWith) == 0)
			{
				return _help;
			}
			return null;
		}
		//<--ISyntaxErrorHelp
	}
}